home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / binutils.7 / binutils / binutils-2.7 / gas / doc / as.info-4 < prev    next >
Encoding:
GNU Info File  |  1996-07-15  |  47.3 KB  |  1,279 lines

  1. This is Info file as.info, produced by Makeinfo-1.55 from the input
  2. file ./as.texinfo.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * As: (as).                     The GNU assembler.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file documents the GNU Assembler "as".
  9.  
  10.    Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation,
  11. Inc.
  12.  
  13.    Permission is granted to make and distribute verbatim copies of this
  14. manual provided the copyright notice and this permission notice are
  15. preserved on all copies.
  16.  
  17.    Permission is granted to copy and distribute modified versions of
  18. this manual under the conditions for verbatim copying, provided that
  19. the entire resulting derived work is distributed under the terms of a
  20. permission notice identical to this one.
  21.  
  22.    Permission is granted to copy and distribute translations of this
  23. manual into another language, under the above conditions for modified
  24. versions.
  25.  
  26. 
  27. File: as.info,  Node: i386-Syntax,  Next: i386-Opcodes,  Prev: i386-Options,  Up: i386-Dependent
  28.  
  29. AT&T Syntax versus Intel Syntax
  30. -------------------------------
  31.  
  32.    In order to maintain compatibility with the output of `gcc', `as'
  33. supports AT&T System V/386 assembler syntax.  This is quite different
  34. from Intel syntax.  We mention these differences because almost all
  35. 80386 documents used only Intel syntax.  Notable differences between
  36. the two syntaxes are:
  37.  
  38.    * AT&T immediate operands are preceded by `$'; Intel immediate
  39.      operands are undelimited (Intel `push 4' is AT&T `pushl $4').
  40.      AT&T register operands are preceded by `%'; Intel register operands
  41.      are undelimited.  AT&T absolute (as opposed to PC relative)
  42.      jump/call operands are prefixed by `*'; they are undelimited in
  43.      Intel syntax.
  44.  
  45.    * AT&T and Intel syntax use the opposite order for source and
  46.      destination operands.  Intel `add eax, 4' is `addl $4, %eax'.  The
  47.      `source, dest' convention is maintained for compatibility with
  48.      previous Unix assemblers.
  49.  
  50.    * In AT&T syntax the size of memory operands is determined from the
  51.      last character of the opcode name.  Opcode suffixes of `b', `w',
  52.      and `l' specify byte (8-bit), word (16-bit), and long (32-bit)
  53.      memory references.  Intel syntax accomplishes this by prefixes
  54.      memory operands (*not* the opcodes themselves) with `byte ptr',
  55.      `word ptr', and `dword ptr'.  Thus, Intel `mov al, byte ptr FOO'
  56.      is `movb FOO, %al' in AT&T syntax.
  57.  
  58.    * Immediate form long jumps and calls are `lcall/ljmp $SECTION,
  59.      $OFFSET' in AT&T syntax; the Intel syntax is `call/jmp far
  60.      SECTION:OFFSET'.  Also, the far return instruction is `lret
  61.      $STACK-ADJUST' in AT&T syntax; Intel syntax is `ret far
  62.      STACK-ADJUST'.
  63.  
  64.    * The AT&T assembler does not provide support for multiple section
  65.      programs.  Unix style systems expect all programs to be single
  66.      sections.
  67.  
  68. 
  69. File: as.info,  Node: i386-Opcodes,  Next: i386-Regs,  Prev: i386-Syntax,  Up: i386-Dependent
  70.  
  71. Opcode Naming
  72. -------------
  73.  
  74.    Opcode names are suffixed with one character modifiers which specify
  75. the size of operands.  The letters `b', `w', and `l' specify byte,
  76. word, and long operands.  If no suffix is specified by an instruction
  77. and it contains no memory operands then `as' tries to fill in the
  78. missing suffix based on the destination register operand (the last one
  79. by convention).  Thus, `mov %ax, %bx' is equivalent to `movw %ax, %bx';
  80. also, `mov $1, %bx' is equivalent to `movw $1, %bx'.  Note that this is
  81. incompatible with the AT&T Unix assembler which assumes that a missing
  82. opcode suffix implies long operand size.  (This incompatibility does
  83. not affect compiler output since compilers always explicitly specify
  84. the opcode suffix.)
  85.  
  86.    Almost all opcodes have the same names in AT&T and Intel format.
  87. There are a few exceptions.  The sign extend and zero extend
  88. instructions need two sizes to specify them.  They need a size to
  89. sign/zero extend *from* and a size to zero extend *to*.  This is
  90. accomplished by using two opcode suffixes in AT&T syntax.  Base names
  91. for sign extend and zero extend are `movs...' and `movz...' in AT&T
  92. syntax (`movsx' and `movzx' in Intel syntax).  The opcode suffixes are
  93. tacked on to this base name, the *from* suffix before the *to* suffix.
  94. Thus, `movsbl %al, %edx' is AT&T syntax for "move sign extend *from*
  95. %al *to* %edx."  Possible suffixes, thus, are `bl' (from byte to long),
  96. `bw' (from byte to word), and `wl' (from word to long).
  97.  
  98.    The Intel-syntax conversion instructions
  99.  
  100.    * `cbw' -- sign-extend byte in `%al' to word in `%ax',
  101.  
  102.    * `cwde' -- sign-extend word in `%ax' to long in `%eax',
  103.  
  104.    * `cwd' -- sign-extend word in `%ax' to long in `%dx:%ax',
  105.  
  106.    * `cdq' -- sign-extend dword in `%eax' to quad in `%edx:%eax',
  107.  
  108. are called `cbtw', `cwtl', `cwtd', and `cltd' in AT&T naming.  `as'
  109. accepts either naming for these instructions.
  110.  
  111.    Far call/jump instructions are `lcall' and `ljmp' in AT&T syntax,
  112. but are `call far' and `jump far' in Intel convention.
  113.  
  114. 
  115. File: as.info,  Node: i386-Regs,  Next: i386-prefixes,  Prev: i386-Opcodes,  Up: i386-Dependent
  116.  
  117. Register Naming
  118. ---------------
  119.  
  120.    Register operands are always prefixes with `%'.  The 80386 registers
  121. consist of
  122.  
  123.    * the 8 32-bit registers `%eax' (the accumulator), `%ebx', `%ecx',
  124.      `%edx', `%edi', `%esi', `%ebp' (the frame pointer), and `%esp'
  125.      (the stack pointer).
  126.  
  127.    * the 8 16-bit low-ends of these: `%ax', `%bx', `%cx', `%dx', `%di',
  128.      `%si', `%bp', and `%sp'.
  129.  
  130.    * the 8 8-bit registers: `%ah', `%al', `%bh', `%bl', `%ch', `%cl',
  131.      `%dh', and `%dl' (These are the high-bytes and low-bytes of `%ax',
  132.      `%bx', `%cx', and `%dx')
  133.  
  134.    * the 6 section registers `%cs' (code section), `%ds' (data
  135.      section), `%ss' (stack section), `%es', `%fs', and `%gs'.
  136.  
  137.    * the 3 processor control registers `%cr0', `%cr2', and `%cr3'.
  138.  
  139.    * the 6 debug registers `%db0', `%db1', `%db2', `%db3', `%db6', and
  140.      `%db7'.
  141.  
  142.    * the 2 test registers `%tr6' and `%tr7'.
  143.  
  144.    * the 8 floating point register stack `%st' or equivalently
  145.      `%st(0)', `%st(1)', `%st(2)', `%st(3)', `%st(4)', `%st(5)',
  146.      `%st(6)', and `%st(7)'.
  147.  
  148. 
  149. File: as.info,  Node: i386-prefixes,  Next: i386-Memory,  Prev: i386-Regs,  Up: i386-Dependent
  150.  
  151. Opcode Prefixes
  152. ---------------
  153.  
  154.    Opcode prefixes are used to modify the following opcode.  They are
  155. used to repeat string instructions, to provide section overrides, to
  156. perform bus lock operations, and to give operand and address size
  157. (16-bit operands are specified in an instruction by prefixing what would
  158. normally be 32-bit operands with a "operand size" opcode prefix).
  159. Opcode prefixes are usually given as single-line instructions with no
  160. operands, and must directly precede the instruction they act upon.  For
  161. example, the `scas' (scan string) instruction is repeated with:
  162.              repne
  163.              scas
  164.  
  165.    Here is a list of opcode prefixes:
  166.  
  167.    * Section override prefixes `cs', `ds', `ss', `es', `fs', `gs'.
  168.      These are automatically added by specifying using the
  169.      SECTION:MEMORY-OPERAND form for memory references.
  170.  
  171.    * Operand/Address size prefixes `data16' and `addr16' change 32-bit
  172.      operands/addresses into 16-bit operands/addresses.  Note that
  173.      16-bit addressing modes (i.e. 8086 and 80286 addressing modes) are
  174.      not supported (yet).
  175.  
  176.    * The bus lock prefix `lock' inhibits interrupts during execution of
  177.      the instruction it precedes.  (This is only valid with certain
  178.      instructions; see a 80386 manual for details).
  179.  
  180.    * The wait for coprocessor prefix `wait' waits for the coprocessor
  181.      to complete the current instruction.  This should never be needed
  182.      for the 80386/80387 combination.
  183.  
  184.    * The `rep', `repe', and `repne' prefixes are added to string
  185.      instructions to make them repeat `%ecx' times.
  186.  
  187. 
  188. File: as.info,  Node: i386-Memory,  Next: i386-jumps,  Prev: i386-prefixes,  Up: i386-Dependent
  189.  
  190. Memory References
  191. -----------------
  192.  
  193.    An Intel syntax indirect memory reference of the form
  194.  
  195.      SECTION:[BASE + INDEX*SCALE + DISP]
  196.  
  197. is translated into the AT&T syntax
  198.  
  199.      SECTION:DISP(BASE, INDEX, SCALE)
  200.  
  201. where BASE and INDEX are the optional 32-bit base and index registers,
  202. DISP is the optional displacement, and SCALE, taking the values 1, 2,
  203. 4, and 8, multiplies INDEX to calculate the address of the operand.  If
  204. no SCALE is specified, SCALE is taken to be 1.  SECTION specifies the
  205. optional section register for the memory operand, and may override the
  206. default section register (see a 80386 manual for section register
  207. defaults). Note that section overrides in AT&T syntax *must* have be
  208. preceded by a `%'.  If you specify a section override which coincides
  209. with the default section register, `as' does *not* output any section
  210. register override prefixes to assemble the given instruction.  Thus,
  211. section overrides can be specified to emphasize which section register
  212. is used for a given memory operand.
  213.  
  214.    Here are some examples of Intel and AT&T style memory references:
  215.  
  216. AT&T: `-4(%ebp)', Intel:  `[ebp - 4]'
  217.      BASE is `%ebp'; DISP is `-4'. SECTION is missing, and the default
  218.      section is used (`%ss' for addressing with `%ebp' as the base
  219.      register).  INDEX, SCALE are both missing.
  220.  
  221. AT&T: `foo(,%eax,4)', Intel: `[foo + eax*4]'
  222.      INDEX is `%eax' (scaled by a SCALE 4); DISP is `foo'.  All other
  223.      fields are missing.  The section register here defaults to `%ds'.
  224.  
  225. AT&T: `foo(,1)'; Intel `[foo]'
  226.      This uses the value pointed to by `foo' as a memory operand.  Note
  227.      that BASE and INDEX are both missing, but there is only *one* `,'.
  228.      This is a syntactic exception.
  229.  
  230. AT&T: `%gs:foo'; Intel `gs:foo'
  231.      This selects the contents of the variable `foo' with section
  232.      register SECTION being `%gs'.
  233.  
  234.    Absolute (as opposed to PC relative) call and jump operands must be
  235. prefixed with `*'.  If no `*' is specified, `as' always chooses PC
  236. relative addressing for jump/call labels.
  237.  
  238.    Any instruction that has a memory operand *must* specify its size
  239. (byte, word, or long) with an opcode suffix (`b', `w', or `l',
  240. respectively).
  241.  
  242. 
  243. File: as.info,  Node: i386-jumps,  Next: i386-Float,  Prev: i386-Memory,  Up: i386-Dependent
  244.  
  245. Handling of Jump Instructions
  246. -----------------------------
  247.  
  248.    Jump instructions are always optimized to use the smallest possible
  249. displacements.  This is accomplished by using byte (8-bit) displacement
  250. jumps whenever the target is sufficiently close.  If a byte displacement
  251. is insufficient a long (32-bit) displacement is used.  We do not support
  252. word (16-bit) displacement jumps (i.e. prefixing the jump instruction
  253. with the `addr16' opcode prefix), since the 80386 insists upon masking
  254. `%eip' to 16 bits after the word displacement is added.
  255.  
  256.    Note that the `jcxz', `jecxz', `loop', `loopz', `loope', `loopnz'
  257. and `loopne' instructions only come in byte displacements, so that if
  258. you use these instructions (`gcc' does not use them) you may get an
  259. error message (and incorrect code).  The AT&T 80386 assembler tries to
  260. get around this problem by expanding `jcxz foo' to
  261.  
  262.               jcxz cx_zero
  263.               jmp cx_nonzero
  264.      cx_zero: jmp foo
  265.      cx_nonzero:
  266.  
  267. 
  268. File: as.info,  Node: i386-Float,  Next: i386-16bit,  Prev: i386-jumps,  Up: i386-Dependent
  269.  
  270. Floating Point
  271. --------------
  272.  
  273.    All 80387 floating point types except packed BCD are supported.
  274. (BCD support may be added without much difficulty).  These data types
  275. are 16-, 32-, and 64- bit integers, and single (32-bit), double
  276. (64-bit), and extended (80-bit) precision floating point.  Each
  277. supported type has an opcode suffix and a constructor associated with
  278. it.  Opcode suffixes specify operand's data types.  Constructors build
  279. these data types into memory.
  280.  
  281.    * Floating point constructors are `.float' or `.single', `.double',
  282.      and `.tfloat' for 32-, 64-, and 80-bit formats.  These correspond
  283.      to opcode suffixes `s', `l', and `t'.  `t' stands for temporary
  284.      real, and that the 80387 only supports this format via the `fldt'
  285.      (load temporary real to stack top) and `fstpt' (store temporary
  286.      real and pop stack) instructions.
  287.  
  288.    * Integer constructors are `.word', `.long' or `.int', and `.quad'
  289.      for the 16-, 32-, and 64-bit integer formats.  The corresponding
  290.      opcode suffixes are `s' (single), `l' (long), and `q' (quad).  As
  291.      with the temporary real format the 64-bit `q' format is only
  292.      present in the `fildq' (load quad integer to stack top) and
  293.      `fistpq' (store quad integer and pop stack) instructions.
  294.  
  295.    Register to register operations do not require opcode suffixes, so
  296. that `fst %st, %st(1)' is equivalent to `fstl %st, %st(1)'.
  297.  
  298.    Since the 80387 automatically synchronizes with the 80386 `fwait'
  299. instructions are almost never needed (this is not the case for the
  300. 80286/80287 and 8086/8087 combinations).  Therefore, `as' suppresses
  301. the `fwait' instruction whenever it is implicitly selected by one of
  302. the `fn...' instructions.  For example, `fsave' and `fnsave' are
  303. treated identically.  In general, all the `fn...' instructions are made
  304. equivalent to `f...' instructions.  If `fwait' is desired it must be
  305. explicitly coded.
  306.  
  307. 
  308. File: as.info,  Node: i386-16bit,  Next: i386-Notes,  Prev: i386-Float,  Up: i386-Dependent
  309.  
  310. Writing 16-bit Code
  311. -------------------
  312.  
  313.    While GAS normally writes only "pure" 32-bit i386 code, it has
  314. limited support for writing code to run in real mode or in 16-bit
  315. protected mode code segments.  To do this, insert a `.code16' directive
  316. before the assembly language instructions to be run in 16-bit mode.
  317. You can switch GAS back to writing normal 32-bit code with the
  318. `.code32' directive.
  319.  
  320.    GAS understands exactly the same assembly language syntax in 16-bit
  321. mode as in 32-bit mode.  The function of any given instruction is
  322. exactly the same regardless of mode, as long as the resulting object
  323. code is executed in the mode for which GAS wrote it.  So, for example,
  324. the `ret' mnemonic produces a 32-bit return instruction regardless of
  325. whether it is to be run in 16-bit or 32-bit mode.  (If GAS is in 16-bit
  326. mode, it will add an operand size prefix to the instruction to force it
  327. to be a 32-bit return.)
  328.  
  329.    This means, for one thing, that you can use GNU CC to write code to
  330. be run in real mode or 16-bit protected mode.  Just insert the statement
  331. `asm(".code16");' at the beginning of your C source file, and while GNU
  332. CC will still be generating 32-bit code, GAS will automatically add all
  333. the necessary size prefixes to make that code run in 16-bit mode.  Of
  334. course, since GNU CC only writes small-model code (it doesn't know how
  335. to attach segment selectors to pointers like native x86 compilers do),
  336. any 16-bit code you write with GNU CC will essentially be limited to a
  337. 64K address space.  Also, there will be a code size and performance
  338. penalty due to all the extra address and operand size prefixes GAS has
  339. to add to the instructions.
  340.  
  341.    Note that placing GAS in 16-bit mode does not mean that the resulting
  342. code will necessarily run on a 16-bit pre-80386 processor.  To write
  343. code that runs on such a processor, you would have to refrain from using
  344. *any* 32-bit constructs which require GAS to output address or operand
  345. size prefixes.  At the moment this would be rather difficult, because
  346. GAS currently supports *only* 32-bit addressing modes: when writing
  347. 16-bit code, it *always* outputs address size prefixes for any
  348. instruction that uses a non-register addressing mode.  So you can write
  349. code that runs on 16-bit processors, but only if that code never
  350. references memory.
  351.  
  352. 
  353. File: as.info,  Node: i386-Notes,  Prev: i386-16bit,  Up: i386-Dependent
  354.  
  355. Notes
  356. -----
  357.  
  358.    There is some trickery concerning the `mul' and `imul' instructions
  359. that deserves mention.  The 16-, 32-, and 64-bit expanding multiplies
  360. (base opcode `0xf6'; extension 4 for `mul' and 5 for `imul') can be
  361. output only in the one operand form.  Thus, `imul %ebx, %eax' does
  362. *not* select the expanding multiply; the expanding multiply would
  363. clobber the `%edx' register, and this would confuse `gcc' output.  Use
  364. `imul %ebx' to get the 64-bit product in `%edx:%eax'.
  365.  
  366.    We have added a two operand form of `imul' when the first operand is
  367. an immediate mode expression and the second operand is a register.
  368. This is just a shorthand, so that, multiplying `%eax' by 69, for
  369. example, can be done with `imul $69, %eax' rather than `imul $69, %eax,
  370. %eax'.
  371.  
  372. 
  373. File: as.info,  Node: i960-Dependent,  Next: M68K-Dependent,  Prev: i386-Dependent,  Up: Machine Dependencies
  374.  
  375. Intel 80960 Dependent Features
  376. ==============================
  377.  
  378. * Menu:
  379.  
  380. * Options-i960::                i960 Command-line Options
  381. * Floating Point-i960::         Floating Point
  382. * Directives-i960::             i960 Machine Directives
  383. * Opcodes for i960::            i960 Opcodes
  384.  
  385. 
  386. File: as.info,  Node: Options-i960,  Next: Floating Point-i960,  Up: i960-Dependent
  387.  
  388. i960 Command-line Options
  389. -------------------------
  390.  
  391. `-ACA | -ACA_A | -ACB | -ACC | -AKA | -AKB | -AKC | -AMC'
  392.      Select the 80960 architecture.  Instructions or features not
  393.      supported by the selected architecture cause fatal errors.
  394.  
  395.      `-ACA' is equivalent to `-ACA_A'; `-AKC' is equivalent to `-AMC'.
  396.      Synonyms are provided for compatibility with other tools.
  397.  
  398.      If you do not specify any of these options, `as' generates code
  399.      for any instruction or feature that is supported by *some* version
  400.      of the 960 (even if this means mixing architectures!).  In
  401.      principle, `as' attempts to deduce the minimal sufficient
  402.      processor type if none is specified; depending on the object code
  403.      format, the processor type may be recorded in the object file.  If
  404.      it is critical that the `as' output match a specific architecture,
  405.      specify that architecture explicitly.
  406.  
  407. `-b'
  408.      Add code to collect information about conditional branches taken,
  409.      for later optimization using branch prediction bits.  (The
  410.      conditional branch instructions have branch prediction bits in the
  411.      CA, CB, and CC architectures.)  If BR represents a conditional
  412.      branch instruction, the following represents the code generated by
  413.      the assembler when `-b' is specified:
  414.  
  415.                   call    INCREMENT ROUTINE
  416.                   .word   0       # pre-counter
  417.           Label:  BR
  418.                   call    INCREMENT ROUTINE
  419.                   .word   0       # post-counter
  420.  
  421.      The counter following a branch records the number of times that
  422.      branch was *not* taken; the differenc between the two counters is
  423.      the number of times the branch *was* taken.
  424.  
  425.      A table of every such `Label' is also generated, so that the
  426.      external postprocessor `gbr960' (supplied by Intel) can locate all
  427.      the counters.  This table is always labelled `__BRANCH_TABLE__';
  428.      this is a local symbol to permit collecting statistics for many
  429.      separate object files.  The table is word aligned, and begins with
  430.      a two-word header.  The first word, initialized to 0, is used in
  431.      maintaining linked lists of branch tables.  The second word is a
  432.      count of the number of entries in the table, which follow
  433.      immediately: each is a word, pointing to one of the labels
  434.      illustrated above.
  435.  
  436.            +------------+------------+------------+ ... +------------+
  437.            |            |            |            |     |            |
  438.            |  *NEXT     |  COUNT: N  | *BRLAB 1   |     | *BRLAB N   |
  439.            |            |            |            |     |            |
  440.            +------------+------------+------------+ ... +------------+
  441.           
  442.                          __BRANCH_TABLE__ layout
  443.  
  444.      The first word of the header is used to locate multiple branch
  445.      tables, since each object file may contain one. Normally the links
  446.      are maintained with a call to an initialization routine, placed at
  447.      the beginning of each function in the file.  The GNU C compiler
  448.      generates these calls automatically when you give it a `-b' option.
  449.      For further details, see the documentation of `gbr960'.
  450.  
  451. `-no-relax'
  452.      Normally, Compare-and-Branch instructions with targets that require
  453.      displacements greater than 13 bits (or that have external targets)
  454.      are replaced with the corresponding compare (or `chkbit') and
  455.      branch instructions.  You can use the `-no-relax' option to
  456.      specify that `as' should generate errors instead, if the target
  457.      displacement is larger than 13 bits.
  458.  
  459.      This option does not affect the Compare-and-Jump instructions; the
  460.      code emitted for them is *always* adjusted when necessary
  461.      (depending on displacement size), regardless of whether you use
  462.      `-no-relax'.
  463.  
  464. 
  465. File: as.info,  Node: Floating Point-i960,  Next: Directives-i960,  Prev: Options-i960,  Up: i960-Dependent
  466.  
  467. Floating Point
  468. --------------
  469.  
  470.    `as' generates IEEE floating-point numbers for the directives
  471. `.float', `.double', `.extended', and `.single'.
  472.  
  473. 
  474. File: as.info,  Node: Directives-i960,  Next: Opcodes for i960,  Prev: Floating Point-i960,  Up: i960-Dependent
  475.  
  476. i960 Machine Directives
  477. -----------------------
  478.  
  479. `.bss SYMBOL, LENGTH, ALIGN'
  480.      Reserve LENGTH bytes in the bss section for a local SYMBOL,
  481.      aligned to the power of two specified by ALIGN.  LENGTH and ALIGN
  482.      must be positive absolute expressions.  This directive differs
  483.      from `.lcomm' only in that it permits you to specify an alignment.
  484.      *Note `.lcomm': Lcomm.
  485.  
  486. `.extended FLONUMS'
  487.      `.extended' expects zero or more flonums, separated by commas; for
  488.      each flonum, `.extended' emits an IEEE extended-format (80-bit)
  489.      floating-point number.
  490.  
  491. `.leafproc CALL-LAB, BAL-LAB'
  492.      You can use the `.leafproc' directive in conjunction with the
  493.      optimized `callj' instruction to enable faster calls of leaf
  494.      procedures.  If a procedure is known to call no other procedures,
  495.      you may define an entry point that skips procedure prolog code
  496.      (and that does not depend on system-supplied saved context), and
  497.      declare it as the BAL-LAB using `.leafproc'.  If the procedure
  498.      also has an entry point that goes through the normal prolog, you
  499.      can specify that entry point as CALL-LAB.
  500.  
  501.      A `.leafproc' declaration is meant for use in conjunction with the
  502.      optimized call instruction `callj'; the directive records the data
  503.      needed later to choose between converting the `callj' into a `bal'
  504.      or a `call'.
  505.  
  506.      CALL-LAB is optional; if only one argument is present, or if the
  507.      two arguments are identical, the single argument is assumed to be
  508.      the `bal' entry point.
  509.  
  510. `.sysproc NAME, INDEX'
  511.      The `.sysproc' directive defines a name for a system procedure.
  512.      After you define it using `.sysproc', you can use NAME to refer to
  513.      the system procedure identified by INDEX when calling procedures
  514.      with the optimized call instruction `callj'.
  515.  
  516.      Both arguments are required; INDEX must be between 0 and 31
  517.      (inclusive).
  518.  
  519. 
  520. File: as.info,  Node: Opcodes for i960,  Prev: Directives-i960,  Up: i960-Dependent
  521.  
  522. i960 Opcodes
  523. ------------
  524.  
  525.    All Intel 960 machine instructions are supported; *note i960
  526. Command-line Options: Options-i960. for a discussion of selecting the
  527. instruction subset for a particular 960 architecture.
  528.  
  529.    Some opcodes are processed beyond simply emitting a single
  530. corresponding instruction: `callj', and Compare-and-Branch or
  531. Compare-and-Jump instructions with target displacements larger than 13
  532. bits.
  533.  
  534. * Menu:
  535.  
  536. * callj-i960::                  `callj'
  537. * Compare-and-branch-i960::     Compare-and-Branch
  538.  
  539. 
  540. File: as.info,  Node: callj-i960,  Next: Compare-and-branch-i960,  Up: Opcodes for i960
  541.  
  542. `callj'
  543. .......
  544.  
  545.    You can write `callj' to have the assembler or the linker determine
  546. the most appropriate form of subroutine call: `call', `bal', or
  547. `calls'.  If the assembly source contains enough information--a
  548. `.leafproc' or `.sysproc' directive defining the operand--then `as'
  549. translates the `callj'; if not, it simply emits the `callj', leaving it
  550. for the linker to resolve.
  551.  
  552. 
  553. File: as.info,  Node: Compare-and-branch-i960,  Prev: callj-i960,  Up: Opcodes for i960
  554.  
  555. Compare-and-Branch
  556. ..................
  557.  
  558.    The 960 architectures provide combined Compare-and-Branch
  559. instructions that permit you to store the branch target in the lower 13
  560. bits of the instruction word itself.  However, if you specify a branch
  561. target far enough away that its address won't fit in 13 bits, the
  562. assembler can either issue an error, or convert your Compare-and-Branch
  563. instruction into separate instructions to do the compare and the branch.
  564.  
  565.    Whether `as' gives an error or expands the instruction depends on
  566. two choices you can make: whether you use the `-no-relax' option, and
  567. whether you use a "Compare and Branch" instruction or a "Compare and
  568. Jump" instruction.  The "Jump" instructions are *always* expanded if
  569. necessary; the "Branch" instructions are expanded when necessary
  570. *unless* you specify `-no-relax'--in which case `as' gives an error
  571. instead.
  572.  
  573.    These are the Compare-and-Branch instructions, their "Jump" variants,
  574. and the instruction pairs they may expand into:
  575.  
  576.              Compare and
  577.           Branch      Jump       Expanded to
  578.           ------    ------       ------------
  579.              bbc                 chkbit; bno
  580.              bbs                 chkbit; bo
  581.           cmpibe    cmpije       cmpi; be
  582.           cmpibg    cmpijg       cmpi; bg
  583.          cmpibge   cmpijge       cmpi; bge
  584.           cmpibl    cmpijl       cmpi; bl
  585.          cmpible   cmpijle       cmpi; ble
  586.          cmpibno   cmpijno       cmpi; bno
  587.          cmpibne   cmpijne       cmpi; bne
  588.           cmpibo    cmpijo       cmpi; bo
  589.           cmpobe    cmpoje       cmpo; be
  590.           cmpobg    cmpojg       cmpo; bg
  591.          cmpobge   cmpojge       cmpo; bge
  592.           cmpobl    cmpojl       cmpo; bl
  593.          cmpoble   cmpojle       cmpo; ble
  594.          cmpobne   cmpojne       cmpo; bne
  595.  
  596. 
  597. File: as.info,  Node: M68K-Dependent,  Next: MIPS-Dependent,  Prev: i960-Dependent,  Up: Machine Dependencies
  598.  
  599. M680x0 Dependent Features
  600. =========================
  601.  
  602. * Menu:
  603.  
  604. * M68K-Opts::                   M680x0 Options
  605. * M68K-Syntax::                 Syntax
  606. * M68K-Moto-Syntax::            Motorola Syntax
  607. * M68K-Float::                  Floating Point
  608. * M68K-Directives::             680x0 Machine Directives
  609. * M68K-opcodes::                Opcodes
  610.  
  611. 
  612. File: as.info,  Node: M68K-Opts,  Next: M68K-Syntax,  Up: M68K-Dependent
  613.  
  614. M680x0 Options
  615. --------------
  616.  
  617.    The Motorola 680x0 version of `as' has a few machine dependent
  618. options.
  619.  
  620.    You can use the `-l' option to shorten the size of references to
  621. undefined symbols.  If you do not use the `-l' option, references to
  622. undefined symbols are wide enough for a full `long' (32 bits).  (Since
  623. `as' cannot know where these symbols end up, `as' can only allocate
  624. space for the linker to fill in later.  Since `as' does not know how
  625. far away these symbols are, it allocates as much space as it can.)  If
  626. you use this option, the references are only one word wide (16 bits).
  627. This may be useful if you want the object file to be as small as
  628. possible, and you know that the relevant symbols are always less than
  629. 17 bits away.
  630.  
  631.    For some configurations, especially those where the compiler normally
  632. does not prepend an underscore to the names of user variables, the
  633. assembler requires a `%' before any use of a register name.  This is
  634. intended to let the assembler distinguish between C variables and
  635. functions named `a0' through `a7', and so on.  The `%' is always
  636. accepted, but is not required for certain configurations, notably
  637. `sun3'.  The `--register-prefix-optional' option may be used to permit
  638. omitting the `%' even for configurations for which it is normally
  639. required.  If this is done, it will generally be impossible to refer to
  640. C variables and functions with the same names as register names.
  641.  
  642.    Normally the character `|' is treated as a comment character, which
  643. means that it can not be used in expressions.  The `--bitwise-or'
  644. option turns `|' into a normal character.  In this mode, you must
  645. either use C style comments, or start comments with a `#' character at
  646. the beginning of a line.
  647.  
  648.    `as' can assemble code for several different members of the Motorola
  649. 680x0 family.  The default depends upon how `as' was configured when it
  650. was built; normally, the default is to assemble code for the 68020
  651. microprocessor.  The following options may be used to change the
  652. default.  These options control which instructions and addressing modes
  653. are permitted.  The members of the 680x0 family are very similar.  For
  654. detailed information about the differences, see the Motorola manuals.
  655.  
  656. `-m68000'
  657. `-m68008'
  658. `-m68302'
  659.      Assemble for the 68000.  `-m68008' and `-m68302' are synonyms for
  660.      `-m68000', since the chips are the same from the point of view of
  661.      the assembler.
  662.  
  663. `-m68010'
  664.      Assemble for the 68010.
  665.  
  666. `-m68020'
  667.      Assemble for the 68020.  This is normally the default.
  668.  
  669. `-m68030'
  670.      Assemble for the 68030.
  671.  
  672. `-m68040'
  673.      Assemble for the 68040.
  674.  
  675. `-m68060'
  676.      Assemble for the 68060.
  677.  
  678. `-mcpu32'
  679. `-m68331'
  680. `-m68332'
  681. `-m68333'
  682. `-m68340'
  683. `-m68360'
  684.      Assemble for the CPU32 family of chips.
  685.  
  686. `-m68881'
  687. `-m68882'
  688.      Assemble 68881 floating point instructions.  This is the default
  689.      for the 68020, 68030, and the CPU32.  The 68040 and 68060 always
  690.      support floating point instructions.
  691.  
  692. `-mno-68881'
  693.      Do not assemble 68881 floating point instructions.  This is the
  694.      default for 68000 and the 68010.  The 68040 and 68060 always
  695.      support floating point instructions, even if this option is used.
  696.  
  697. `-m68851'
  698.      Assemble 68851 MMU instructions.  This is the default for the
  699.      68020, 68030, and 68060.  The 68040 accepts a somewhat different
  700.      set of MMU instructions; `-m68851' and `-m68040' should not be used
  701.      together.
  702.  
  703. `-mno-68851'
  704.      Do not assemble 68851 MMU instructions.  This is the default for
  705.      the 68000, 68010, and the CPU32.  The 68040 accepts a somewhat
  706.      different set of MMU instructions.
  707.  
  708. 
  709. File: as.info,  Node: M68K-Syntax,  Next: M68K-Moto-Syntax,  Prev: M68K-Opts,  Up: M68K-Dependent
  710.  
  711. Syntax
  712. ------
  713.  
  714.    This syntax for the Motorola 680x0 was developed at MIT.
  715.  
  716.    The 680x0 version of `as' uses instructions names and syntax
  717. compatible with the Sun assembler.  Intervening periods are ignored;
  718. for example, `movl' is equivalent to `mov.l'.
  719.  
  720.    In the following table APC stands for any of the address registers
  721. (`%a0' through `%a7'), the program counter (`%pc'), the zero-address
  722. relative to the program counter (`%zpc'), a suppressed address register
  723. (`%za0' through `%za7'), or it may be omitted entirely.  The use of
  724. SIZE means one of `w' or `l', and it may be omitted, along with the
  725. leading colon, unless a scale is also specified.  The use of SCALE
  726. means one of `1', `2', `4', or `8', and it may always be omitted along
  727. with the leading colon.
  728.  
  729.    The following addressing modes are understood:
  730. "Immediate"
  731.      `#NUMBER'
  732.  
  733. "Data Register"
  734.      `%d0' through `%d7'
  735.  
  736. "Address Register"
  737.      `%a0' through `%a7'
  738.      `%a7' is also known as `%sp', i.e. the Stack Pointer.  `%a6' is
  739.      also known as `%fp', the Frame Pointer.
  740.  
  741. "Address Register Indirect"
  742.      `%a0@' through `%a7@'
  743.  
  744. "Address Register Postincrement"
  745.      `%a0@+' through `%a7@+'
  746.  
  747. "Address Register Predecrement"
  748.      `%a0@-' through `%a7@-'
  749.  
  750. "Indirect Plus Offset"
  751.      `APC@(NUMBER)'
  752.  
  753. "Index"
  754.      `APC@(NUMBER,REGISTER:SIZE:SCALE)'
  755.  
  756.      The NUMBER may be omitted.
  757.  
  758. "Postindex"
  759.      `APC@(NUMBER)@(ONUMBER,REGISTER:SIZE:SCALE)'
  760.  
  761.      The ONUMBER or the REGISTER, but not both, may be omitted.
  762.  
  763. "Preindex"
  764.      `APC@(NUMBER,REGISTER:SIZE:SCALE)@(ONUMBER)'
  765.  
  766.      The NUMBER may be omitted.  Omitting the REGISTER produces the
  767.      Postindex addressing mode.
  768.  
  769. "Absolute"
  770.      `SYMBOL', or `DIGITS', optionally followed by `:b', `:w', or `:l'.
  771.  
  772. 
  773. File: as.info,  Node: M68K-Moto-Syntax,  Next: M68K-Float,  Prev: M68K-Syntax,  Up: M68K-Dependent
  774.  
  775. Motorola Syntax
  776. ---------------
  777.  
  778.    The standard Motorola syntax for this chip differs from the syntax
  779. already discussed (*note Syntax: M68K-Syntax.).  `as' can accept
  780. Motorola syntax for operands, even if MIT syntax is used for other
  781. operands in the same instruction.  The two kinds of syntax are fully
  782. compatible.
  783.  
  784.    In the following table APC stands for any of the address registers
  785. (`%a0' through `%a7'), the program counter (`%pc'), the zero-address
  786. relative to the program counter (`%zpc'), or a suppressed address
  787. register (`%za0' through `%za7').  The use of SIZE means one of `w' or
  788. `l', and it may always be omitted along with the leading dot.  The use
  789. of SCALE means one of `1', `2', `4', or `8', and it may always be
  790. omitted along with the leading asterisk.
  791.  
  792.    The following additional addressing modes are understood:
  793.  
  794. "Address Register Indirect"
  795.      `(%a0)' through `(%a7)'
  796.      `%a7' is also known as `%sp', i.e. the Stack Pointer.  `%a6' is
  797.      also known as `%fp', the Frame Pointer.
  798.  
  799. "Address Register Postincrement"
  800.      `(%a0)+' through `(%a7)+'
  801.  
  802. "Address Register Predecrement"
  803.      `-(%a0)' through `-(%a7)'
  804.  
  805. "Indirect Plus Offset"
  806.      `NUMBER(%A0)' through `NUMBER(%A7)', or `NUMBER(%PC)'.
  807.  
  808.      The NUMBER may also appear within the parentheses, as in
  809.      `(NUMBER,%A0)'.  When used with the PC, the NUMBER may be omitted
  810.      (with an address register, omitting the NUMBER produces Address
  811.      Register Indirect mode).
  812.  
  813. "Index"
  814.      `NUMBER(APC,REGISTER.SIZE*SCALE)'
  815.  
  816.      The NUMBER may be omitted, or it may appear within the
  817.      parentheses.  The APC may be omitted.  The REGISTER and the APC
  818.      may appear in either order.  If both APC and REGISTER are address
  819.      registers, and the SIZE and SCALE are omitted, then the first
  820.      register is taken as the base register, and the second as the
  821.      index register.
  822.  
  823. "Postindex"
  824.      `([NUMBER,APC],REGISTER.SIZE*SCALE,ONUMBER)'
  825.  
  826.      The ONUMBER, or the REGISTER, or both, may be omitted.  Either the
  827.      NUMBER or the APC may be omitted, but not both.
  828.  
  829. "Preindex"
  830.      `([NUMBER,APC,REGISTER.SIZE*SCALE],ONUMBER)'
  831.  
  832.      The NUMBER, or the APC, or the REGISTER, or any two of them, may
  833.      be omitted.  The ONUMBER may be omitted.  The REGISTER and the APC
  834.      may appear in either order.  If both APC and REGISTER are address
  835.      registers, and the SIZE and SCALE are omitted, then the first
  836.      register is taken as the base register, and the second as the
  837.      index register.
  838.  
  839. 
  840. File: as.info,  Node: M68K-Float,  Next: M68K-Directives,  Prev: M68K-Moto-Syntax,  Up: M68K-Dependent
  841.  
  842. Floating Point
  843. --------------
  844.  
  845.    Packed decimal (P) format floating literals are not supported.  Feel
  846. free to add the code!
  847.  
  848.    The floating point formats generated by directives are these.
  849.  
  850. `.float'
  851.      `Single' precision floating point constants.
  852.  
  853. `.double'
  854.      `Double' precision floating point constants.
  855.  
  856. `.extend'
  857. `.ldouble'
  858.      `Extended' precision (`long double') floating point constants.
  859.  
  860. 
  861. File: as.info,  Node: M68K-Directives,  Next: M68K-opcodes,  Prev: M68K-Float,  Up: M68K-Dependent
  862.  
  863. 680x0 Machine Directives
  864. ------------------------
  865.  
  866.    In order to be compatible with the Sun assembler the 680x0 assembler
  867. understands the following directives.
  868.  
  869. `.data1'
  870.      This directive is identical to a `.data 1' directive.
  871.  
  872. `.data2'
  873.      This directive is identical to a `.data 2' directive.
  874.  
  875. `.even'
  876.      This directive is a special case of the `.align' directive; it
  877.      aligns the output to an even byte boundary.
  878.  
  879. `.skip'
  880.      This directive is identical to a `.space' directive.
  881.  
  882. 
  883. File: as.info,  Node: M68K-opcodes,  Prev: M68K-Directives,  Up: M68K-Dependent
  884.  
  885. Opcodes
  886. -------
  887.  
  888. * Menu:
  889.  
  890. * M68K-Branch::                 Branch Improvement
  891. * M68K-Chars::                  Special Characters
  892.  
  893. 
  894. File: as.info,  Node: M68K-Branch,  Next: M68K-Chars,  Up: M68K-opcodes
  895.  
  896. Branch Improvement
  897. ..................
  898.  
  899.    Certain pseudo opcodes are permitted for branch instructions.  They
  900. expand to the shortest branch instruction that reach the target.
  901. Generally these mnemonics are made by substituting `j' for `b' at the
  902. start of a Motorola mnemonic.
  903.  
  904.    The following table summarizes the pseudo-operations.  A `*' flags
  905. cases that are more fully described after the table:
  906.  
  907.                Displacement
  908.                +-------------------------------------------------
  909.                |                68020   68000/10
  910.      Pseudo-Op |BYTE    WORD    LONG    LONG      non-PC relative
  911.                +-------------------------------------------------
  912.           jbsr |bsrs    bsr     bsrl    jsr       jsr
  913.            jra |bras    bra     bral    jmp       jmp
  914.      *     jXX |bXXs    bXX     bXXl    bNXs;jmpl bNXs;jmp
  915.      *    dbXX |dbXX    dbXX        dbXX; bra; jmpl
  916.      *    fjXX |fbXXw   fbXXw   fbXXl             fbNXw;jmp
  917.      
  918.      XX: condition
  919.      NX: negative of condition XX
  920.  
  921.                     `*'--see full description below
  922.  
  923. `jbsr'
  924. `jra'
  925.      These are the simplest jump pseudo-operations; they always map to
  926.      one particular machine instruction, depending on the displacement
  927.      to the branch target.
  928.  
  929. `jXX'
  930.      Here, `jXX' stands for an entire family of pseudo-operations,
  931.      where XX is a conditional branch or condition-code test.  The full
  932.      list of pseudo-ops in this family is:
  933.            jhi   jls   jcc   jcs   jne   jeq   jvc
  934.            jvs   jpl   jmi   jge   jlt   jgt   jle
  935.  
  936.      For the cases of non-PC relative displacements and long
  937.      displacements on the 68000 or 68010, `as' issues a longer code
  938.      fragment in terms of NX, the opposite condition to XX.  For
  939.      example, for the non-PC relative case:
  940.               jXX foo
  941.      gives
  942.                bNXs oof
  943.                jmp foo
  944.            oof:
  945.  
  946. `dbXX'
  947.      The full family of pseudo-operations covered here is
  948.            dbhi   dbls   dbcc   dbcs   dbne   dbeq   dbvc
  949.            dbvs   dbpl   dbmi   dbge   dblt   dbgt   dble
  950.            dbf    dbra   dbt
  951.  
  952.      Other than for word and byte displacements, when the source reads
  953.      `dbXX foo', `as' emits
  954.                dbXX oo1
  955.                bra oo2
  956.            oo1:jmpl foo
  957.            oo2:
  958.  
  959. `fjXX'
  960.      This family includes
  961.            fjne   fjeq   fjge   fjlt   fjgt   fjle   fjf
  962.            fjt    fjgl   fjgle  fjnge  fjngl  fjngle fjngt
  963.            fjnle  fjnlt  fjoge  fjogl  fjogt  fjole  fjolt
  964.            fjor   fjseq  fjsf   fjsne  fjst   fjueq  fjuge
  965.            fjugt  fjule  fjult  fjun
  966.  
  967.      For branch targets that are not PC relative, `as' emits
  968.                fbNX oof
  969.                jmp foo
  970.            oof:
  971.      when it encounters `fjXX foo'.
  972.  
  973. 
  974. File: as.info,  Node: M68K-Chars,  Prev: M68K-Branch,  Up: M68K-opcodes
  975.  
  976. Special Characters
  977. ..................
  978.  
  979.    The immediate character is `#' for Sun compatibility.  The
  980. line-comment character is `|' (unless the `--bitwise-or' option is
  981. used).  If a `#' appears at the beginning of a line, it is treated as a
  982. comment unless it looks like `# line file', in which case it is treated
  983. normally.
  984.  
  985. 
  986. File: as.info,  Node: MIPS-Dependent,  Next: SH-Dependent,  Prev: M68K-Dependent,  Up: Machine Dependencies
  987.  
  988. MIPS Dependent Features
  989. =======================
  990.  
  991.    GNU `as' for MIPS architectures supports the MIPS R2000, R3000,
  992. R4000 and R6000 processors.  For information about the MIPS instruction
  993. set, see `MIPS RISC Architecture', by Kane and Heindrich
  994. (Prentice-Hall).  For an overview of MIPS assembly conventions, see
  995. "Appendix D: Assembly Language Programming" in the same work.
  996.  
  997. * Menu:
  998.  
  999. * MIPS Opts::   Assembler options
  1000. * MIPS Object:: ECOFF object code
  1001. * MIPS Stabs::  Directives for debugging information
  1002. * MIPS ISA::    Directives to override the ISA level
  1003.  
  1004. 
  1005. File: as.info,  Node: MIPS Opts,  Next: MIPS Object,  Up: MIPS-Dependent
  1006.  
  1007. Assembler options
  1008. -----------------
  1009.  
  1010.    The MIPS configurations of GNU `as' support these special options:
  1011.  
  1012. `-G NUM'
  1013.      This option sets the largest size of an object that can be
  1014.      referenced implicitly with the `gp' register.  It is only accepted
  1015.      for targets that use ECOFF format.  The default value is 8.
  1016.  
  1017. `-EB'
  1018. `-EL'
  1019.      Any MIPS configuration of `as' can select big-endian or
  1020.      little-endian output at run time (unlike the other GNU development
  1021.      tools, which must be configured for one or the other).  Use `-EB'
  1022.      to select big-endian output, and `-EL' for little-endian.
  1023.  
  1024. `-mips1'
  1025. `-mips2'
  1026. `-mips3'
  1027.      Generate code for a particular MIPS Instruction Set Architecture
  1028.      level.  `-mips1' corresponds to the R2000 and R3000 processors,
  1029.      `-mips2' to the R6000 processor, and `-mips3' to the R4000
  1030.      processor.  You can also switch instruction sets during the
  1031.      assembly; see *Note Directives to override the ISA level: MIPS ISA.
  1032.  
  1033. `-m4650'
  1034. `-no-m4650'
  1035.      Generate code for the MIPS R4650 chip.  This tells the assembler
  1036.      to accept the `mad' and `madu' instruction, and to not schedule
  1037.      `nop' instructions around accesses to the `HI' and `LO' registers.
  1038.      `-no-m4650' turns off this option.
  1039.  
  1040. `-m4010'
  1041. `-no-m4010'
  1042.      Generate code for the LSI R4010 chip.  This tells the assembler to
  1043.      accept the R4010 specific instructions (`addciu', `ffc', etc.),
  1044.      and to not schedule `nop' instructions around accesses to the `HI'
  1045.      and `LO' registers.  `-no-m4010' turns off this option.
  1046.  
  1047. `-mcpu=CPU'
  1048.      Generate code for a particular MIPS cpu.  This has little effect
  1049.      on the assembler, but it is passed by `gcc'.
  1050.  
  1051. `-nocpp'
  1052.      This option is ignored.  It is accepted for command-line
  1053.      compatibility with other assemblers, which use it to turn off C
  1054.      style preprocessing.  With GNU `as', there is no need for
  1055.      `-nocpp', because the GNU assembler itself never runs the C
  1056.      preprocessor.
  1057.  
  1058. `--trap'
  1059. `--no-break'
  1060.      `as' automatically macro expands certain division and
  1061.      multiplication instructions to check for overflow and division by
  1062.      zero.  This option causes `as' to generate code to take a trap
  1063.      exception rather than a break exception when an error is detected.
  1064.      The trap instructions are only supported at Instruction Set
  1065.      Architecture level 2 and higher.
  1066.  
  1067. `--break'
  1068. `--no-trap'
  1069.      Generate code to take a break exception rather than a trap
  1070.      exception when an error is detected.  This is the default.
  1071.  
  1072. 
  1073. File: as.info,  Node: MIPS Object,  Next: MIPS Stabs,  Prev: MIPS Opts,  Up: MIPS-Dependent
  1074.  
  1075. MIPS ECOFF object code
  1076. ----------------------
  1077.  
  1078.    Assembling for a MIPS ECOFF target supports some additional sections
  1079. besides the usual `.text', `.data' and `.bss'.  The additional sections
  1080. are `.rdata', used for read-only data, `.sdata', used for small data,
  1081. and `.sbss', used for small common objects.
  1082.  
  1083.    When assembling for ECOFF, the assembler uses the `$gp' (`$28')
  1084. register to form the address of a "small object".  Any object in the
  1085. `.sdata' or `.sbss' sections is considered "small" in this sense.  For
  1086. external objects, or for objects in the `.bss' section, you can use the
  1087. `gcc' `-G' option to control the size of objects addressed via `$gp';
  1088. the default value is 8, meaning that a reference to any object eight
  1089. bytes or smaller uses `$gp'.  Passing `-G 0' to `as' prevents it from
  1090. using the `$gp' register on the basis of object size (but the assembler
  1091. uses `$gp' for objects in `.sdata' or `sbss' in any case).  The size of
  1092. an object in the `.bss' section is set by the `.comm' or `.lcomm'
  1093. directive that defines it.  The size of an external object may be set
  1094. with the `.extern' directive.  For example, `.extern sym,4' declares
  1095. that the object at `sym' is 4 bytes in length, whie leaving `sym'
  1096. otherwise undefined.
  1097.  
  1098.    Using small ECOFF objects requires linker support, and assumes that
  1099. the `$gp' register is correctly initialized (normally done
  1100. automatically by the startup code).  MIPS ECOFF assembly code must not
  1101. modify the `$gp' register.
  1102.  
  1103. 
  1104. File: as.info,  Node: MIPS Stabs,  Next: MIPS ISA,  Prev: MIPS Object,  Up: MIPS-Dependent
  1105.  
  1106. Directives for debugging information
  1107. ------------------------------------
  1108.  
  1109.    MIPS ECOFF `as' supports several directives used for generating
  1110. debugging information which are not support by traditional MIPS
  1111. assemblers.  These are `.def', `.endef', `.dim', `.file', `.scl',
  1112. `.size', `.tag', `.type', `.val', `.stabd', `.stabn', and `.stabs'.
  1113. The debugging information generated by the three `.stab' directives can
  1114. only be read by GDB, not by traditional MIPS debuggers (this
  1115. enhancement is required to fully support C++ debugging).  These
  1116. directives are primarily used by compilers, not assembly language
  1117. programmers!
  1118.  
  1119. 
  1120. File: as.info,  Node: MIPS ISA,  Prev: MIPS Stabs,  Up: MIPS-Dependent
  1121.  
  1122. Directives to override the ISA level
  1123. ------------------------------------
  1124.  
  1125.    GNU `as' supports an additional directive to change the MIPS
  1126. Instruction Set Architecture level on the fly: `.set mipsN'.  N should
  1127. be a number from 0 to 3.  A value from 1 to 3 makes the assembler
  1128. accept instructions for the corresponding ISA level, from that point on
  1129. in the assembly.  `.set mipsN' affects not only which instructions are
  1130. permitted, but also how certain macros are expanded.  `.set mips0'
  1131. restores the ISA level to its original level: either the level you
  1132. selected with command line options, or the default for your
  1133. configuration.  You can use this feature to permit specific R4000
  1134. instructions while assembling in 32 bit mode.  Use this directive with
  1135. care!
  1136.  
  1137.    Traditional MIPS assemblers do not support this directive.
  1138.  
  1139. 
  1140. File: as.info,  Node: SH-Dependent,  Next: Sparc-Dependent,  Prev: MIPS-Dependent,  Up: Machine Dependencies
  1141.  
  1142. Hitachi SH Dependent Features
  1143. =============================
  1144.  
  1145. * Menu:
  1146.  
  1147. * SH Options::              Options
  1148. * SH Syntax::               Syntax
  1149. * SH Floating Point::       Floating Point
  1150. * SH Directives::           SH Machine Directives
  1151. * SH Opcodes::              Opcodes
  1152.  
  1153. 
  1154. File: as.info,  Node: SH Options,  Next: SH Syntax,  Up: SH-Dependent
  1155.  
  1156. Options
  1157. -------
  1158.  
  1159.    `as' has no additional command-line options for the Hitachi SH
  1160. family.
  1161.  
  1162. 
  1163. File: as.info,  Node: SH Syntax,  Next: SH Floating Point,  Prev: SH Options,  Up: SH-Dependent
  1164.  
  1165. Syntax
  1166. ------
  1167.  
  1168. * Menu:
  1169.  
  1170. * SH-Chars::                Special Characters
  1171. * SH-Regs::                 Register Names
  1172. * SH-Addressing::           Addressing Modes
  1173.  
  1174. 
  1175. File: as.info,  Node: SH-Chars,  Next: SH-Regs,  Up: SH Syntax
  1176.  
  1177. Special Characters
  1178. ..................
  1179.  
  1180.    `!' is the line comment character.
  1181.  
  1182.    You can use `;' instead of a newline to separate statements.
  1183.  
  1184.    Since `$' has no special meaning, you may use it in symbol names.
  1185.  
  1186. 
  1187. File: as.info,  Node: SH-Regs,  Next: SH-Addressing,  Prev: SH-Chars,  Up: SH Syntax
  1188.  
  1189. Register Names
  1190. ..............
  1191.  
  1192.    You can use the predefined symbols `r0', `r1', `r2', `r3', `r4',
  1193. `r5', `r6', `r7', `r8', `r9', `r10', `r11', `r12', `r13', `r14', and
  1194. `r15' to refer to the SH registers.
  1195.  
  1196.    The SH also has these control registers:
  1197.  
  1198. `pr'
  1199.      procedure register (holds return address)
  1200.  
  1201. `pc'
  1202.      program counter
  1203.  
  1204. `mach'
  1205. `macl'
  1206.      high and low multiply accumulator registers
  1207.  
  1208. `sr'
  1209.      status register
  1210.  
  1211. `gbr'
  1212.      global base register
  1213.  
  1214. `vbr'
  1215.      vector base register (for interrupt vectors)
  1216.  
  1217. 
  1218. File: as.info,  Node: SH-Addressing,  Prev: SH-Regs,  Up: SH Syntax
  1219.  
  1220. Addressing Modes
  1221. ................
  1222.  
  1223.    `as' understands the following addressing modes for the SH.  `RN' in
  1224. the following refers to any of the numbered registers, but *not* the
  1225. control registers.
  1226.  
  1227. `RN'
  1228.      Register direct
  1229.  
  1230. `@RN'
  1231.      Register indirect
  1232.  
  1233. `@-RN'
  1234.      Register indirect with pre-decrement
  1235.  
  1236. `@RN+'
  1237.      Register indirect with post-increment
  1238.  
  1239. `@(DISP, RN)'
  1240.      Register indirect with displacement
  1241.  
  1242. `@(R0, RN)'
  1243.      Register indexed
  1244.  
  1245. `@(DISP, GBR)'
  1246.      `GBR' offset
  1247.  
  1248. `@(R0, GBR)'
  1249.      GBR indexed
  1250.  
  1251. `ADDR'
  1252. `@(DISP, PC)'
  1253.      PC relative address (for branch or for addressing memory).  The
  1254.      `as' implementation allows you to use the simpler form ADDR
  1255.      anywhere a PC relative address is called for; the alternate form
  1256.      is supported for compatibility with other assemblers.
  1257.  
  1258. `#IMM'
  1259.      Immediate data
  1260.  
  1261. 
  1262. File: as.info,  Node: SH Floating Point,  Next: SH Directives,  Prev: SH Syntax,  Up: SH-Dependent
  1263.  
  1264. Floating Point
  1265. --------------
  1266.  
  1267.    The SH family has no hardware floating point, but the `.float'
  1268. directive generates IEEE floating-point numbers for compatibility with
  1269. other development tools.
  1270.  
  1271. 
  1272. File: as.info,  Node: SH Directives,  Next: SH Opcodes,  Prev: SH Floating Point,  Up: SH-Dependent
  1273.  
  1274. SH Machine Directives
  1275. ---------------------
  1276.  
  1277.    `as' has no machine-dependent directives for the SH.
  1278.  
  1279.